package cn.sdormitory.controller;

import cn.sdormitory.common.api.CommonResult;
import cn.sdormitory.common.exception.ApiException;
import cn.sdormitory.workflow.service.WorkFlowCommonService;
import cn.sdormitory.workflow.vo.WorkFlowHiVO;
import cn.sdormitory.workflow.vo.WorkFlowVO;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.ProcessEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: lx
 * @date: 2023/10/18 10:50
 * @description:
 */
@RestController
@RequestMapping("/app/workflow")
@Slf4j
public class AppWorkFlowController {

    @Autowired
    private WorkFlowCommonService workFlowCommonService;

    /**
     * 审批历史
     * @param vo
     * @return
     * @throws ApiException
     */
    @PostMapping("/historyWorkFlowList")
    public CommonResult<List<WorkFlowHiVO>> historyWorkFlowList(@RequestBody WorkFlowVO vo) throws ApiException{
        List<WorkFlowHiVO> list = workFlowCommonService.historyWorkFlowList(vo.getProcessInstanceId());
        return CommonResult.success(list);
    }

}
